//
//  MZY_Home_picCell.m
//  FullHouse
//
//  Created by dllo on 16/1/28.
//  Copyright © 2016年 yy. All rights reserved.
//

#import "MZY_Home_picCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

@implementation MZY_Home_picCell

- (void)dealloc
{
    [self.screenView release];
    [self.picImageView release];
    [self.likeButton release];
    [self.leftTextField release];
    [self.addButton release];
    [self.addCountLabel release];
    [self.midTextField release];
    [self.commentCountLabel release];
    [self.commentButton release];
    [self.rightTextField release];
    [self.shareButton release];
    [self.detailLabel release];
    [self.bottomView release];
    [super dealloc];
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{
    self.contentView.backgroundColor = [UIColor yellowColor];
    
    self.screenView = [[UIView alloc]init];
    self.screenView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.screenView];
    [self.screenView release];
    
    self.picImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:self.picImageView];
    [self.picImageView release];
    
    self.detailLabel = [[UILabel alloc]init];
    self.detailLabel.backgroundColor = [UIColor whiteColor];
    [self.screenView addSubview:self.detailLabel];
    [self.detailLabel release];
    
    self.bottomView = [[UIView alloc]init];
    self.bottomView.backgroundColor = [UIColor cyanColor];
    [self.screenView addSubview:self.bottomView];
    [self.bottomView release];
    
    self.likeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.screenView addSubview:self.likeButton];
    
    self.leftTextField = [[UITextField alloc]init];
    self.leftTextField.backgroundColor = [UIColor lightGrayColor];
    [self.screenView addSubview:self.leftTextField];
    [self.leftTextField release];
    
    self.addButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.screenView addSubview:self.addButton];
    
    self.addCountLabel = [[UILabel alloc]init];
    [self.screenView addSubview:self.addCountLabel];
    [self.addCountLabel release];
    
    self.midTextField= [[UITextField alloc]init];
    self.midTextField.backgroundColor = [UIColor lightGrayColor];
    [self.screenView addSubview:self.midTextField];
    [self.midTextField release];
    
    self.commentButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.screenView addSubview:self.commentButton];
    
    self.commentCountLabel = [[UILabel alloc]init];
    [self.screenView addSubview:self.commentCountLabel];
    [self.commentCountLabel release];
    
    self.rightTextField = [[UITextField alloc]init];
    self.rightTextField.backgroundColor = [UIColor lightGrayColor];
    [self.screenView addSubview:self.rightTextField];
    [self.rightTextField release];
    
    self.shareButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.screenView addSubview:self.shareButton];
    
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.screenView.frame = CGRectMake(10, 10, WIDTH - 20, HEIGHT - 20);
    self.picImageView.frame = CGRectMake(10, 10, WIDTH - 20, HEIGHT - 120);
    self.detailLabel.frame = CGRectMake(10, HEIGHT - 110, WIDTH - 30, 50);
    self.likeButton.frame = CGRectMake(WIDTH / 8 - 20, HEIGHT - 50, 30, 30);
    self.leftTextField.frame = CGRectMake(WIDTH / 4, HEIGHT - 50, 2, 30);
    self.addButton.frame = CGRectMake(WIDTH / 8 * 3 - 30, HEIGHT - 50, 30, 30);
    self.addCountLabel.frame = CGRectMake(WIDTH / 3 + 25, HEIGHT - 50, 30, 30);
    self.midTextField.frame = CGRectMake(WIDTH / 2, HEIGHT - 50, 1, 30);
    self.commentButton.frame = CGRectMake(WIDTH / 8 * 5 - 30, HEIGHT - 50, 30, 30);
    self.commentCountLabel.frame = CGRectMake(WIDTH / 8 * 5 + 10, HEIGHT - 50, 30, 30);
    self.rightTextField.frame = CGRectMake(WIDTH / 4 * 3, HEIGHT - 50, 2, 30);
    self.shareButton.frame = CGRectMake(WIDTH / 8 * 7 - 20, HEIGHT - 50, 30, 30);
    self.bottomView.frame = CGRectMake(0, HEIGHT - 60, WIDTH - 20, 50);
}

@end
